Fix early bootstrap of secondary VCPUs on x86/64.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 21 Oct 2005 13:33:46 +0000 (14:33 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 21 Oct 2005 13:33:46 +0000 (14:33 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c

index a0ec7cff1f2c6eb43bd401dde8627a96e24ab0ac..f1f733df5a61cf8893db88bd30e23fbdeb2fd42f 100644 (file)
@@ -179,6 +179,8 @@ void vcpu_prepare(int vcpu)
        ctxt.syscall_callback_eip  = (unsigned long)system_call;
 
        ctxt.ctrlreg[3] = virt_to_mfn(init_level4_pgt) << PAGE_SHIFT;
+
+       ctxt.gs_base_kernel = (unsigned long)(cpu_pda + vcpu);
 #endif
 
        BUG_ON(HYPERVISOR_vcpu_op(VCPUOP_initialise, vcpu, &ctxt));
@@ -208,6 +210,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                if (IS_ERR(idle))
                        panic("failed fork for CPU %d", cpu);
 
+#ifdef __x86_64__
+               cpu_pda[cpu].pcurrent = idle;
+               cpu_pda[cpu].cpunumber = cpu;
+               per_cpu(init_tss,cpu).rsp0 = idle->thread.rsp;
+               clear_ti_thread_flag(idle->thread_info, TIF_FORK);
+#endif
+
                irq_ctx_init(cpu);
 
                cpu_gdt_descr[cpu].address =